$(function(){
	var isflag=$("#isflag").val();
	if(isflag==undefined||isflag==null||isflag==''||isflag==false||isflag=='false'){
		$("#radio1").attr("checked", "checked"); 
	}
	else{
		$("#radio2").attr("checked", "checked"); 
	}
	$("#cancleBut").click(function(){
		parent.$('#dlg').window('close');
		parent.$(document.body).remove()
	});
	var codelength=$('#operatorid').width();
	$('#operatorid').validatebox({
	    required: true,
	    validType:{
	    	custom_remote:['/operator/checkCode',operatorid,'编号已存在'],
	    },
	    tipPosition:'top',
	    delay:1000,
	    deltaX:codelength/4
	});
	$('#operatormobile').validatebox({
	    required: true,
	    validType: 'mobile',
	    tipPosition:'top',
	    deltaX:codelength/4
	});
	$('#email').validatebox({
	    required: true,
	    validType: 'email',
	    tipPosition:'top',
	    deltaX:codelength/4
	});
	//提交表单
	$("#submitBut").click(function(){
		$("#form").form('submit',{
			url:'/operator/saveOperator',
			onSubmit:function(){
		        return $(this).form('validate');
		    },
		    success:function(data){
		    	var jdata=$.parseJSON(data); 
		        if(jdata.code==200){
		        	$.messager.alert('成功','保存成功','info',function(){
		        		parent.$('#dlg').window('close');
		        		window.parent.refreshTab("操作员管理");
		        	});
		        }
		        else{
		        	$.messager.alert('失败',jdata.msg,'error');
		        }
		    }
		});
	})
})